import { request } from '@/utils/request.js'

/**
 * 销售成本流水 API JS
 */

export default {

  /**
   * 获取销售成本流水分页列表
   * @returns
   */
  getList (params = {}) {
    return request({
      url: 'finance/cost/index',
      method: 'get',
      params
    })
  },
  /**
   * 添加销售成本流水
   * @returns
   */
  save (data = {}) {
    return request({
      url: 'finance/cost/save',
      method: 'post',
      data
    })
  },
  //批量添加
  saveBatch (id,data = {}) {
    return request({
      url: 'finance/cost/saveBatch/'+id,
      method: 'post',
      data
    })
  },
  /**
   * 更新销售成本流水数据
   * @returns
   */
  update (data = {}) {
    return request({
      url: 'finance/cost/update/' + data.id,
      method: 'put',
      data
    })
  },

  /**
   * 将销售成本流水删除，有软删除则移动到回收站
   * @returns
   */
  deletes (data) {
    return request({
      url: 'finance/cost/delete',
      method: 'delete',
      data
    })
  },

  /**
   * 读取销售成本流水
   * @returns
   */
  read (id) {
    return request({
      url: 'finance/cost/read/' + id,
      method: 'get',
    })
  },

  /**
   * 从回收站获取销售成本流水数据列表
   * @returns
   */
  getRecycleList (params = {}) {
    return request({
      url: 'finance/cost/recycle',
      method: 'get',
      params
    })
  },

  /**
   * 恢复销售成本流水数据
   * @returns
   */
  recoverys (data) {
    return request({
      url: 'finance/cost/recovery',
      method: 'put',
      data
    })
  },

  /**
   * 真实删除销售成本流水
   * @returns
   */
  realDeletes (data) {
    return request({
      url: 'finance/cost/realDelete',
      method: 'delete',
      data
    })
  },

  /**
   * 销售成本流水导出
   * @returns
   */
  exportExcel (params = {}) {
    return request({
      url: 'finance/cost/export',
      method: 'post',
      responseType: 'blob',
      params
    })
  },
  /**
   * 通过审计
   * @returns
   */
  auditPass (data = {}) {
    return request({
      url: 'finance/cost/audit/pass',
      method: 'post',
      data
    })
  },
  /**
   * 反审计
   * @returns
   */
  auditRefuse (data = {}) {
    return request({
      url: 'finance/cost/audit/refuse',
      method: 'post',
      data
    })
  },

}